package com.caigou.controller;

import com.caigou.bean.exam.entity.Users;
import com.caigou.bean.vo.KeyValueVO;
import com.caigou.enums.ResponseEnum;
import com.caigou.security.utils.CurrentUser;
import com.caigou.service.IDictionaryService;
import com.caigou.util.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/dictionary")
public class DictionaryController {

    @Resource
    private IDictionaryService dictionaryService;


    /**
     * 查询部门列表
     *
     * @param user
     * @return
     */
    @GetMapping("/department/list")
    public Result<List<KeyValueVO>> findDepartments(@CurrentUser Users user) {
        return dictionaryService.findDepartments();
    }


    /**
     * 查询角色列表
     *
     * @param user
     * @return
     */
    @GetMapping("/role/list")
    public Result<List<KeyValueVO>> findRoles(@CurrentUser Users user) {
        return dictionaryService.findRoles();
    }

    /**
     * 查询所有权限列表
     *
     * @param user
     * @return
     */
//    @GetMapping("/privilege/list")
//    public Result<List<KeyValueVO>> findPrivileges(@CurrentUser Users user) {
//        //return dictionaryService.findPrivilegesByParam();
//    }


}
